import { defineStore } from 'pinia';
import defaultSettings from '@/config/index'
const {
    logo,
    title,
} = defaultSettings

export const useSettingStore = defineStore('setting', {
    state: () => {
        return {
            logo,
            title,

            sidebar: {
                opened: true,
                withoutAnimation: false
            },
            device: 'desktop',
            size: 'mini'
        };
    },
    actions: {
        toggleSideBar() {
            this.sidebar.opened = !this.sidebar.opened
            this.sidebar.withoutAnimation = false

        },
        closeSideBar({ withoutAnimation }) {
            this.sidebar.opened = false
            this.sidebar.withoutAnimation = withoutAnimation
        },
        toggleDevice(device: string) {
            this.device = device
        },
        setSize(size: string) {
            this.size = size
        }
    }
});